<template>
    <el-drawer title="考核进度" v-model="visible" size="80%">
      <el-table
        :data="tableData"
        row-key="id"
        height="90%"
        stripe
      >
        <el-table-column type="index" label="#" sortable />
        <el-table-column prop="progress" label="进度说明" />
        <el-table-column prop="managerUser.real_name" label="管理审核" />
        <el-table-column prop="comment" label="审核评语" />
        <el-table-column prop="score" label="打分" />
        <el-table-column prop="create_time" label="提交时间" width="120px" />
        <el-table-column prop="update_time" label="审核时间" width="120px" />
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        background
        :current-page="curPage"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
      <InfoDialog @getTable="getTableInfo" ref="infoRef"></InfoDialog>
      <ExamineDrawer ref="examineRef" />
    </el-drawer>
  </template>
  
  <script setup lang="ts">
  import { ref, onMounted, defineEmits, reactive } from "vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import { getExamineLogApi } from "@/api/company/examine";
  const tableData = ref([]);
  const visible = ref(false);
  const examine_id = ref(0);
  const curPage = ref(1);
  const pageSize = ref(20);
  const total = ref(0);
  function getTableInfo() {
    getExamineLogApi({
      examine_id: examine_id.value,
      page: curPage.value,
      page_size: pageSize.value,
    }).then((res) => {
      tableData.value = res.data.data;
      total.value = res.data.total;
    });
  }
  const handleSizeChange = (e: any) => {
    pageSize.value = e;
    getTableInfo();
  };
  const handleCurrentChange = (e: any) => {
    curPage.value = e;
    getTableInfo();
  };
  function dialogOpen(id) {
    examine_id.value = id;
    visible.value = true;
    getTableInfo();
  }
  defineExpose({
    dialogOpen,
  });
  </script>
  
  <style scoped>
  .table-box {
    height: calc(100% - 200px);
  }
  </style>
  